﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;

namespace MolyMade.Moly.MailMessager.SmtpClient
{
    internal class BaseMessage
    {
        public BaseMessage(string mailAddress = null, string sourceId = null, string destId = null,string subject = null,string body = null)
        {
            if (mailAddress != null) this.MailAddress = mailAddress;
            if (sourceId != null) this.SourceId = sourceId;
            if (destId != null) this.DestId = destId;
            if (subject != null) this.Subject = subject;
            if (body != null) this.Body = null;
        }
        private MailMessage _message;
        private MailAddress _sourceMailAddress;
        private MailAddress _destMailAddress;
        public string MailAddress { get; set; }
        public string SourceId { get; set; }
        public string DestId { get; set; }
        public string Subject { get; set; }
        public string Body { get; set; }

        public MailMessage GetMessage()
        {
            _sourceMailAddress = new MailAddress(this.MailAddress,this.SourceId);
            _destMailAddress = new MailAddress(this.MailAddress,this.DestId);
            _message = new MailMessage(_sourceMailAddress,_destMailAddress)
            {
                Subject = this.Subject,
                Body =  this.Body,
                Priority = MailPriority.High
            };
            return _message;
        }

    }
}
